<template>
	<view>
		<view class="boxContent" v-for="(item,index) in violationDetails":key="index" @click="toViolationDetail(item)">
			<view  class="header">
				<view class="box">学生姓名</view>
				<view class="box" style="font-weight: 700; font-size: 25rpx;">{{item.studentName}}</view>
			</view>
			<view style="width: 1rpx; height: 50rpx; background-color: #f1f1f1;"></view>
			<view class="header">
				<view class="box">班级</view>
				<view class="box" style="font-weight: 700; font-size: 25rpx;">{{item.className}}</view>
			</view>
			<view style="width: 1rpx; height: 50rpx; background-color: #f1f1f1;"></view>
			<view class="header">
				<view class="box">违纪时间</view>
				<view class="box" style="font-weight: 700; font-size: 25rpx;">{{item.createTime}}</view>
			</view>
			<view style="width: 1rpx; height: 50rpx; background-color: #f1f1f1;"></view>
			<view class="header">
				<view class="box">违纪内容</view>
				<view class="box" style="font-size: 20rpx;">{{item.violationTypeDetail}}</view>
			</view>
		</view>
		<view class="pic" v-if="violationDetails.length <= 0">
			<image src="https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/wujilu.png" mode="">
			</image>
		</view>
	</view>
</template>

<script>
	import violations from "../../../api/modules/violation.js"
	import {parseTime} from "@/utils/date.js"
	export default {
		data() {
			return {
				startDate: "",
				endDate: "",
				sdId: "",
				violationDetails: [],
				queryParam: {},
			}
		},
		methods: {
			toViolationDetail(item) {
				console.log(item)
				uni.navigateTo({
					url: `/pages_duty/dormitoryTeacher/patrol/patrolStatisticsViolationsDetail?item=${JSON.stringify(item)}`
				})
			},
			getViolationsDetail() {
				console.log("getViolationsDetail")
				this.queryParam.startDate = this.startDate
				this.queryParam.endDate = this.endDate
				this.queryParam.sdId = this.sdId
				violations.getPartrolStatisticsDetail(this.queryParam).then(res => {
					this.violationDetails = res.data
					
					this.violationDetails.forEach((item, index) => {
						item.createTime = parseTime(item.createTime)
					})
					console.log(res)
				})
			}
		},
		onLoad(options) {
			this.startDate = options.startDate
			this.endDate = options.endDate
			this.sdId = options.sdId
			this.getViolationsDetail()
		}
	}
</script>

<style>
	.boxContent {
		background-color: #fff;
		border-radius: 20rpx;
		margin: 10rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx;
		text-align: center;
		border: 1px solid #a2a2a254;
		/* margin-top: 10rpx; */
	}
</style>
